/*
 * BaseShareAreaInfoBO.java 
 * 
 * Copyright 2009 Wangfeng Beijing Inc. 
 * All rights reserved. 
 * 
 * Created on 2012-07-06
 */

package com.bjtech.domain.query;

import org.ssi.web.util.QuerySpecTpl;

import com.bjtech.web.util.SelectBean;

/**
 * 功能概述:分摊域信息管理 <br>
 * 
 * @author 王峰
 */

public class BaseShareAreaInfoQuerySpec extends SelectBean {
	/* */
	private Long id;
	/* */
	private String area_name;
	/* */
	private Long area_state;
	/* */
	private Long proj_id;
	/* */
	private Float base_price;
	/* */
	private Float cal_price;
	/* */
	private Long cal_unit;
	/* */
	private Float area_price;
	/* */
	private String demo;

	@Override
	public void queryParamString() {
		StringBuilder fromPart = new StringBuilder(" where 1=1");

		if (this.isAll != null && this.isAll.intValue() != 1) {
			if (QuerySpecTpl.isValid(id)) {
				fromPart.append(" and a.id = ");
				fromPart.append(id);
			}

			if (QuerySpecTpl.isValid(area_name)) {
				fromPart.append(" and a.area_name like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(area_name);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(area_state)) {
				fromPart.append(" and a.area_state = ");
				fromPart.append(area_state);
			}

			if (QuerySpecTpl.isValid(proj_id)) {
				fromPart.append(" and a.proj_id = ");
				fromPart.append(proj_id);
			}

			if (QuerySpecTpl.isValid(base_price)) {
				fromPart.append(" and a.base_price = ");
				fromPart.append(base_price);
			}

			if (QuerySpecTpl.isValid(cal_price)) {
				fromPart.append(" and a.cal_price = ");
				fromPart.append(cal_price);
			}

			if (QuerySpecTpl.isValid(cal_unit)) {
				fromPart.append(" and a.cal_unit = ");
				fromPart.append(cal_unit);
			}

			if (QuerySpecTpl.isValid(area_price)) {
				fromPart.append(" and a.area_price = ");
				fromPart.append(area_price);
			}

			if (QuerySpecTpl.isValid(demo)) {
				fromPart.append(" and a.demo like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(demo);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(this.direction)
					&& QuerySpecTpl.isValid(this.sort)) {
				fromPart.append(" order by ");
				fromPart.append(this.sort);
				fromPart.append(" ");
				fromPart.append(this.direction);
			} else {
				fromPart.append(" order by ");
				fromPart.append("id");
				fromPart.append(" ");
				fromPart.append("asc");

			}
		}
		super.setQueryString(fromPart.toString());
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getArea_name() {
		return this.area_name;
	}

	public void setArea_name(String area_name) {
		this.area_name = area_name;
	}

	public Long getArea_state() {
		return this.area_state;
	}

	public void setArea_state(Long area_state) {
		this.area_state = area_state;
	}

	public Long getProj_id() {
		return this.proj_id;
	}

	public void setProj_id(Long proj_id) {
		this.proj_id = proj_id;
	}

	public Float getBase_price() {
		return this.base_price;
	}

	public void setBase_price(Float base_price) {
		this.base_price = base_price;
	}

	public Float getCal_price() {
		return this.cal_price;
	}

	public void setCal_price(Float cal_price) {
		this.cal_price = cal_price;
	}

	public Long getCal_unit() {
		return this.cal_unit;
	}

	public void setCal_unit(Long cal_unit) {
		this.cal_unit = cal_unit;
	}

	public Float getArea_price() {
		return this.area_price;
	}

	public void setArea_price(Float area_price) {
		this.area_price = area_price;
	}

	public String getDemo() {
		return this.demo;
	}

	public void setDemo(String demo) {
		this.demo = demo;
	}
}
